package com.online_exam.service.impl;

import com.online_exam.domain.Subject;
import com.online_exam.repository.SubjectMapper;
import com.online_exam.service.SubjectService;
import com.online_exam.viewmodel.admin.education.SubjectEditVm;
import com.online_exam.viewmodel.admin.education.SubjectPageRequestVM;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class SubjectServiceImpl implements SubjectService {
    @Resource
    private SubjectMapper subjectMapper;
    @Override
    public int addSubject(Subject subject) {
        return subjectMapper.addSubject(subject);
    }

    @Override
    public Subject findById(Integer id) {
        return subjectMapper.findById(id);
    }

    @Override
    public List<Subject> findAll() {
        return subjectMapper.findAll();
    }

    @Override
    public List<Subject> page(SubjectPageRequestVM vm) {
        return subjectMapper.page(vm);
    }

    @Override
    public int updateSubject(SubjectEditVm subject) {
        return subjectMapper.updateSubject(subject);
    }

    @Override
    public int deleteById(Integer id) {
        return subjectMapper.deletedById(id);
    }

}
